home *** CD-ROM | disk | FTP | other *** search
- Path: news.sinet.slb.com!usenet
- From: "Vinh D. Nguyen" <vnguyen@sugar-land.anadrill.slb.com>
- Newsgroups: comp.lang.c++
- Subject: Re: passing filenames by ref
- Date: Mon, 11 Mar 1996 18:32:37 -0600
- Organization: Schlumberger Anadrill
- Message-ID: <3144C625.79E@sugar-land.anadrill.slb.com>
- References: <HpARxor+BgbR090yn@delta1.deltanet.com>
- NNTP-Posting-Host: 163.185.118.40
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (WinNT; I)
-
- Tom D. Baccanti wrote:
- >
- > I am a new blind student learning c++ and am having some trouble
- > understanding the way to pass in a filename by reference. If I could get a
- > simple example to look at I will understand it better. If this is too basic
- > of a question please disregard. And yes I am using a screen reader and
- > compiling from the dos command line with borland 4.52. Thanks, Tom Baccanti
- >
- > --
- > Tom D. Baccanti /** Reach me at Internet: TDB@Deltanet.com
- > Pay a visit to the Outpost today at http://www.deltanet.com/users/tdb
- > You can capture my PGP public key by pointing your finger to tdb@deltanet.com
-
- I am not sure what you mean by passing a filename by reference. If you use a null-
- terminated string to store your file name, then you would pass it by address. Or if you
- use a string class such as MFC's CString or something equivalent in BC++, then you can
- do it either of two ways. You can pass a reference to the string into the function as follows:
-
- func( CString & strMyString )
-
- Or more securely if you don't want to content of your string to be modifiable inside
- the function:
-
- func( const CString & strMyString )
-
- The other way is to typecast your CString object into a null-terminated string before
- passing it into the function. It's been ages since I last used BC++, so I don't remember if
- there is such a conversion operator for BC++'s string class.
-
- Good luck with your studies.
- --
- --------------------------------------------------------------------------
- * Vinh Nguyen vnguyen@slb.com *
- * Drilling Information Products - Senior Engineer *
- * 200 Gillingham Ln. (713) 275-7524 (Office) *
- * Sugarland, TX 77478 (713) 275-8098 (FAX) *
- --------------------------------------------------------------------------
-